<?php
include_once "filtro_cabecera.php";
include_once "../funciones/funciones_php.php";
include_once "menu_operacion.php";
?>
    <br />
    <div id="titulo_seccion">
	    <fieldset>
        <table>
	        <tr>
	            <td><font>Administrar Chofer Ruta</font></td>
	        </tr>
	    </table>
        </fieldset>
	</div>
<br />
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Lectura de encomiendas</title>
<link rel="stylesheet" type="text/css" href="../css/plantilla.css" />
<link rel="stylesheet" type="text/css" href="../css/tabla.css" />
</head>
<body>

<table border=0 cellspacing=0 class=data>
<thead class=data>
<tr>
    <th>Ruta</th>
    <th>Chofer Asignado</th>
    <th>Modificar</th>
</tr>
</thead>
<?php
conectar();
$pg = sprintf("SELECT *
                     FROM ruta,empleado
                     where ruta.id_chofer = empleado.id_empleado
                     ORDER BY id_ruta");
$conectar = pg_query($pg) or die ("Error en la consulta".pg_error());

$i = 0;
while($reg = pg_fetch_array($conectar))
{
    $id_ruta = $reg['id_ruta'];
    $ruta = $reg['referencia'];
    $chofer = $reg['nombre'];

    if($chofer == NULL)
    {
        $chofer = 'Sin chofer asignado';
    }

    ($i % 2 == 0 )? $clase = " " : $clase = "class=odd";

    echo "<tbody class=data>
            <tr ".$clase.">
                <td>".$ruta."</td>
                <td>".$chofer."</td>
                <td><a href=javascript:Abrir_ventana('panel_modificar_chofer_ruta.php?ruta=$id_ruta')>Modificar</a></td>
              </tr>
         </tbody>";
   $i++;
}

?>
</table>
</body>
</html>